home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr48
/
pas_0593.zip
/
C8253.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-05-30
|
3KB
|
71 lines
{─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
Msg : 503 of 527
From : David Dahl 1:272/38.0 15 May 93 03:46
To : Mark Lewis
Subj : Timer...
────────────────────────────────────────────────────────────────────────────────
-=> Quoting Mark Lewis to David Dahl <=-
> Uses C8253, { C8253.TPU is the routines I gave you
> last message compiled into a unit
ML> how big is this unit?? how long ago did you post it?? can you post it
ML> again?? if not, where can i grab a copy of it from??
I never posted it as a unit. I just posted a couple
routines to set the timer. They're actually a part of another,
larger project I've been working on to play digitized sound out
of several different output devices. When I was asked if it were
possible to speed up the tick and still have DOS's timer function
behave normally, I threw them into a unit and wrote the program
you quoted from to illustrate how it would be done. Here are the
timer routines as a unit:}
Unit C8253;
(* PUBLIC DOMAIN *)
Interface
Procedure SetPlaySpeed (Speed : LongInt);
Procedure SetDefaultTimerSpeed;
Procedure Set8253Channel (ChannelNumber : Byte;
ProgramValue : Word);
Implementation
Const C8253ModeControl = $43;
C8253Channel : Array[0..2] of Byte = ($40, $41, $42);
C8253OperatingFreq = 1193180;
{=[ 8253 Timer Programming Routines ]=====================================}
Procedure Set8253Channel (ChannelNumber : Byte;
ProgramValue : Word);
Begin
Port[C8253ModeControl] := 54 OR (ChannelNumber SHL 6); { XX110110 }
Port[C8253Channel[ChannelNumber]] := Lo(ProgramValue);
Port[C8253Channel[ChannelNumber]] := Hi(ProgramValue);
End;
{-[ Set Clock Channel 0 (INT 8, IRQ 0) To Input Speed ]-------------------}
Procedure SetPlaySpeed (Speed : LongInt);
Var ProgramValue : Word;
Begin
ProgramValue := C8253OperatingFreq DIV Speed;
Set8253Channel (0, ProgramValue);
End;
{-[ Set Clock Channel 0 Back To 18.2 Default Value ]----------------------}
Procedure SetDefaultTimerSpeed;
Begin
Set8253Channel (0, 0);
End;
End.
The routines perform no error checking on input values, so be careful
with them. The procedure Set8253Channel should never have a
channel value of more than 2 since the 8253 only has 3 channels
(0 - 2).
Dave